/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UnitTest;

import junit.framework.TestCase;
import Model.Evento;
import DB.DBManager;
import DB.Evento.ControllerEvento;
import java.sql.SQLException;
import static junit.framework.TestCase.assertEquals;

/**
 *
 * @author KZA
 */
public class TesteEvento extends TestCase {
    
    DBManager db;
    
    public TesteEvento(String testName, DBManager db) {
        super(testName);
        this.db = db;
    }

//    public void testeEvento() {
//        System.out.println("* Unit_Test: I testeEvento");
//
//        Evento event = new Evento("Show", "Show da Alcione", 50.00, 200, "25102013", "01012013",
//                "01102013", "Rua da Alcione", "Paris", "SP", "Brasil", "87240-364");
//
//        assertEquals("Show",            event.getNome());
//        assertEquals("Show da Alcione", event.getDescricao());
//        assertEquals("50.0",            Double.toString(event.getValor()));
//        assertEquals("200",             Integer.toString(event.getVagas()));
//        assertEquals("25102013",        event.getDataEvento());
//        assertEquals("01012013",        event.getInicioInscricoes());
//        assertEquals("01102013",        event.getFimInscricoes());
//        assertEquals("Rua da Alcione",  event.getEndereco());
//        assertEquals("Paris",           event.getCidade());
//        assertEquals("SP",              event.getEstado());
//        assertEquals("Brasil",          event.getPais());
//        assertEquals("87240-364",       event.getCep());
//
//        System.out.println("* Unit_Test: F testeEvento");
//    }

//    public long testeInsertEventoBanco() throws SQLException, ClassNotFoundException {
//        System.out.println("* Unit_Test: I testeInsertEventoBanco");
//        
//        ControllerEvento ec = ControllerEvento.getInstance();
//        int count = db.getTableCount("eventos");
//        Evento event = new Evento("Show", "Show da Alcione", 50.00, 200, "25102013", "01012013",
//                "01102013", "Rua da Alcione", "Paris", "SP", "Brasil", "87240-364");
//        long id = ec.insert(event);
//
//        assertEquals(count+1, db.getTableCount("eventos"));
//        
//        System.out.println("* Unit_Test: F testeInsertEventoBanco");
//        return id;
//    }
    
//    public void testeUpdateEventoBanco(long id) throws SQLException {
//        System.out.println("* Unit_Test: I testeUpdateEventoBanco");
//        
//        ControllerEvento ec = ControllerEvento.getInstance();
//        int count = db.getTableCount("eventos");
//        Evento event = new Evento("Show", "Show da Alcione", 50.00, 200, "25102013", "01012013",
//                "01102013", "Rua da Alcione", "São Paulo", "SP", "Brasil", "87240-364");
//        event.setId(id);
//        long n = ec.update(event);
//
//        assertEquals(n, 1);
//        assertEquals(count, db.getTableCount("eventos"));
//
//        System.out.println("* Unit_Test: F testeUpdateEventoBanco");
//    }
//    
//    public void testeSelectEventoBanco(long id) throws SQLException {
//        System.out.println("* Unit_Test: I testeSelectEventoBanco");
//
//        Evento event = new Evento();
//        
//        ControllerEvento ec = ControllerEvento.getInstance();
//        
//        event = ec.getByID(id);
//        
//        assertEquals("Show",            event.getNome());
//        assertEquals("Show da Alcione", event.getDescricao());
//        assertEquals("50.0",            Double.toString(event.getValor()));
//        assertEquals("200",             Integer.toString(event.getVagas()));
//        assertEquals("25102013",        event.getDataEvento());
//        assertEquals("01012013",        event.getInicioInscricoes());
//        assertEquals("01102013",        event.getFimInscricoes());
//        assertEquals("Rua da Alcione",  event.getEndereco());
//        assertEquals("São Paulo",       event.getCidade());
//        assertEquals("SP",              event.getEstado());
//        assertEquals("Brasil",          event.getPais());
//        assertEquals("87240-364",       event.getCep());
//        
//        System.out.println("* Unit_Test: F testeSelectEventoBanco");
//    }
}
